Building a TARDIS in CadQuery

This guide explains how to build a TARDIS (Time And Relative Dimension In Space) using the CadQuery Python library. This project covers all steps to create a visual representation of the iconic British blue police box.

Outline of the Project

  1. Install and Set Up CadQuery
  2. Define the Basic Dimensions and Parameters
  3. Create the Base and Walls of the TARDIS
  4. Add Windows and Doors
  5. Add Roof and Light Fixture
  6. Apply Detailing and Color

1. Install and Set Up CadQuery

To start, install CadQuery by running:

pip install cadquery

For the best experience, use an IDE like Jupyter Notebook or a 3D viewer like cq-editor to visualize your model.

2. Define the Basic Dimensions and Parameters

Start by importing CadQuery and defining the dimensions for scalability:

import cadquery as cq

# Define TARDIS dimensions
width = 100  # Width of the TARDIS base in mm
height = 200  # Total height
wall_thickness = 5  # Wall thickness
roof_height = 30  # Height of the roof section
door_height = 130  # Door height
window_height = 30  # Height of window sections

3. Create the Base and Walls of the TARDIS

Using CadQuery, create a hollow square-shaped structure for the walls:

# Create the base shape of the TARDIS
base = cq.Workplane("XY").box(width, width, height - roof_height)
# Add wall thickness for depth
walls = base.faces(">Z").shell(-wall_thickness)

4. Add Windows and Doors

We’ll add small rectangular cutouts on each side for the windows and a larger one for the door.

Windows

window_width = 15
window_spacing = 5

# Create windows on the front face
windows = (
    walls.faces(">Z")
    .workplane(centerOption="CenterOfMass")
    .rect(window_width, window_height, forConstruction=True)
    .vertices().hole(wall_thickness / 2)
)

Doors

# Create a door shape in the front
door = (
    windows.faces(">Z")
    .workplane(centerOption="CenterOfMass")
    .rect(width / 2, door_height)
    .cutBlind(-wall_thickness)
)

5. Add Roof and Light Fixture

To create a roof, add a pyramid shape with a central light fixture:

# Create the pyramid-shaped roof
roof = (
    door.faces(">Z")
    .workplane(centerOption="CenterOfMass")
    .polyline([(width / 2, 0), (width / 4, roof_height), (-width / 2, 0)])
    .close()
    .extrude(wall_thickness)
)

# Add a light fixture on the top center of the roof
light = (
    roof.faces(">Z")
    .workplane(centerOption="CenterOfMass")
    .circle(5)  # Light fixture radius
    .extrude(10)  # Light fixture height
)

6. Apply Detailing and Color

CadQuery does not directly support color, but you can add detailing or colorize in a downstream CAD viewer.

# Add raised lettering for "POLICE BOX" and other details as required